import React, { Component } from 'react';
import { connect } from 'react-redux'

class ReactReduxPage extends Component {
    render() {
        // const {num, dispatch, add} = this.props
        const {num, add} = this.props
        console.log('props:', this.props);
        return (
            <div>
                <h3>ReactReduxPage</h3>
                <p>{ num }</p>
                {/* <button onClick={() => dispatch({type: 'ADD'})}>ADD</button> */}
                <button onClick={add}>ADD</button>
            </div>
        );
    }
}

export default connect(
    state => ({num: state}),
    {
        add: () => ({type: 'ADD'})
    }
)(
    ReactReduxPage
);